package com.lagou.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lagou.dao.ArticleDao;
import com.lagou.pojo.Article;
import com.lagou.pojo.PageParam;
import com.lagou.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author czq
 * @date 2020/7/21 22:52
 */
@Service
public class ArticleServiceImpl implements ArticleService {

    @Autowired
    private ArticleDao articleDao;

    @Override
    public Object findList(PageParam pageParam) {

        // 初始化分页插件
        PageHelper.startPage(pageParam.getPageNum(), pageParam.getPageSize());

        // 查询文章列表
        List<Article> list = articleDao.findList();

        // 返回分页实体
        return new PageInfo<>(list);
    }
}
